package com.troyhigh.njrotc.admintrackerold;

import java.util.Properties;

public class Student implements Comparable
{
    private int group = 0;
    private String lastName = "";
    private String firstName = "";
    private int id = 0;
    private Properties props = new Properties();
    private RibbonData data = new RibbonData();
    
    public Student(int gr, String ln, String fn, int i)
    {
        group = gr;
        lastName = ln;
        firstName = fn;
        id = i;
    }
    
    public Student(int gr, String ln, String fn, int i, Properties p)
    {
        this(gr, ln, fn, i);
        props = p;
    }
    
    public Student(int gr, String ln, String fn, int i, Properties p, RibbonData d)
    {
        this(gr, ln, fn, i, p);
        if(d == null) 
        {
            System.out.println("WTF");
            data = new RibbonData(i);
        }
        else
            data = d;
    }
    
    public String getLastName()
    {
        return lastName;
    }
    
    public String getFirstName()
    {
        return firstName;
    }
    
    public String getName()
    {
        return firstName + " " + lastName;
    }
    
    public int getID()
    {
        return id;
    }
    
    public int getGroup()
    {
        return group;
    }
    
    public Properties getProperties()
    {
        return props;
    }
    
    public void setRibbons(RibbonData r)
    {
        if (r == null) data = new RibbonData(id);
        System.out.println("I wrote an empty null: " + r == null);
        data = r;
        if(r.getID() != id) r.setID(id);
        
    }
    
    public RibbonData getRibbons()
    {
        return data;
    }
    
    @Override
    public String toString()
    {
        return lastName + " " + firstName + " " + id;
    }
    
    public int compareTo(Object obj)
    {
        Student that = ((Student)obj);
        return toString().compareTo(that.toString());
    }   
    
    public boolean equals(Student stu)
    {
        boolean result = toString().equals(stu.toString()) 
               && props.equals(stu.getProperties());
        return result;
    }
}
